#include "../include/wake.h"

uint8_t magickPack[MAGICK_PACKET_SIZE];
IPAddress broadcastIP(255, 255, 255, 255);
WiFiUDP udp;
void sendWOL() {
    for (int i = 0; i < MAGICK_PACKET_PREFIX_SIZE; i++)
        magickPack[i] = 0xff;
    for (int i = 0; i < MAGICK_PACKET_PAYLOAD_SIZE; i++)
        magickPack[MAGICK_PACKET_PREFIX_SIZE + i] = macAddress[i % 6];
    udp.beginPacket(broadcastIP, MAGICK_PACKET_PORT);
    udp.write(magickPack, sizeof magickPack);
    udp.endPacket();
}